/**
 * 
 */
package org.cuatrovientos.craps;

import static org.junit.Assert.*;

import org.junit.Test;

/**
 * @author DAM_S
 *
 */
public class CrapsTest {
	Craps crps;
	/**
	 * Test method for {@link org.cuatrovientos.craps.Craps#putb(double)}.
	 */
	@Test
	public void testPutb() {
		crps=new Craps(100);
		crps.putb(100);
		for (int i=0;i<1000;i++){
		assertEquals(crps.getPbet(),100,0.1);
		assertTrue(crps.getBetz()<200 && crps.getBetz()>=100);
		}
	}

	/**
	 * Test method for {@link org.cuatrovientos.craps.Craps#roll()}.
	 */
	@Test
	public void testRoll() {
		crps= new Craps(100);
		crps.roll();
		for(int i=0;i<1000;i++){
		assertTrue(crps.getD1()<6 && crps.getD1()>=0 && crps.getD2()<6 && crps.getD2()>=0);
		}
	}

	/**
	 * Test method for {@link org.cuatrovientos.craps.Craps#winOrwhat()}.
	 */
	@Test
	public void testWinOrwhat() {
		crps=new Craps(100);
		
	
		for (int i=0;i<10000;i++){
			crps.roll();
			if (crps.getD1()==crps.getD2()){
				assertTrue(crps.winOrwhat());
			}else{
				assertFalse(crps.winOrwhat());
			}
			
		}
	}

}
